package com.qyhl.webtv.module_news.luckydraw;

import android.util.Log;

import com.qyhl.webtv.commonlib.entity.news.SectionBean;

import java.util.List;

/**
 * Created by Administrator on 2018/6/8.
 */

public class LuckDrawPresenter implements LuckDrawContract.LuckDrawPresenter {
    private LuckDrawContract.LuckDrawView mView;

    private LuckDrawModel mModel;

    public LuckDrawPresenter(LuckDrawContract.LuckDrawView mView) {
        this.mView = mView;
        this.mModel = new LuckDrawModel(this);
    }

    @Override
    public void getSections(String catalogId,String typeId) {
        mModel.getSections(catalogId,typeId);
    }

    @Override
    public void setDatas(List<SectionBean> beanList) {
        mView.setDatas(beanList);
    }

    @Override
    public void setError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 2:
                Log.i("empty", msg);
                mView.setEmpty();
                break;
            default:
                mView.setError(msg);
                break;
        }
    }


}
